package PlantasWicket

import modelo.Jugador
import org.apache.wicket.markup.html.WebPage
import org.apache.wicket.markup.html.basic.Label
import org.apache.wicket.markup.html.panel.Panel
import org.apache.wicket.model.CompoundPropertyModel
import org.uqbar.wicket.xtend.WicketExtensionFactoryMethods
import paneles.PanelJardin
import java.awt.TextArea
import org.uqbar.wicket.xtend.XLink
import org.apache.wicket.markup.html.form.TextField
import org.apache.wicket.markup.html.form.Form
import org.uqbar.wicket.xtend.XButton

/**
 * 
 * @author ?
 */
class LoginScreen extends Panel {
	extension WicketExtensionFactoryMethods = new WicketExtensionFactoryMethods
	 
	new(String id, Jugador jugador){
		super(id)
		defaultModel = new CompoundPropertyModel(jugador)
		
		val logForm= new Form("formaLog", jugador.asCompoundModel)
		logForm.addChild(new TextField<String>("nombre"))
		logForm.addChild(
			new XButton("Login") => [
				onClick = [|
					this.replaceWith(new PanelJardin("jardin", jugador))
		]])
		
		this.addChild(logForm)
	}
}
